Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: defer interaction on birthday list command #13

Merged
merged 2 commits into from
Jan 28, 2024

Conversation

benw202
Copy link
Member

@benw202 benw202 commented Jan 28, 2024

Description

Defers the interaction on birthday list command so the interaction doesn't time out when fetching a large amount of birthdays

Test Results

N/A

Discord Username

benw8484

const member = members.get(birthday.userID!);

if (member) {
monthBuckets[birthday.utcDatetime!.getUTCMonth()][1].push(`${member.displayName} - ${birthday.day}/${birthday.month} (Z${birthday.timezone! < 0 ? '' : '+'}${birthday.timezone})`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test that if a birthday has no utcDateTime? Does it then just add another array in the month buckets (which it can't due to it being const) or fail in some way?

Copy link
Member Author

@benw202 benw202 Jan 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Birthday will always have a utcDateTime. It is populated in the setBrithday command. To be fair, these birthday commands could do with an update as they're just a port from the old bot.

Perhaps an update can be done in a future PR.

The whole thing is in a try catch, so if it happened it would be caught

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just asking because of the !, since that's implying that there could be no utcDateTime.just don't know how the array is behaving with that, but since it's just copied from the old bot, it's fine with me

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if I remember the linting thought it could not exist. But, its ensured to exist in the other command therefore it does always exist. But in this file it doesn't know that

@benw202 benw202 merged commit f172e21 into flybywiresim:staging Jan 28, 2024
3 checks passed
@benw202 benw202 deleted the birthday-list-defer branch February 17, 2024 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants